﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="ExpGrid.aspx.cs" Inherits="TrainingCenters.training.shiva.ExpGrid" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
</head>
<body>
    <form id="form1" runat="server">
    <div>
    
        <asp:GridView ID="GridView1" runat="server" AllowPaging="True" 
            AllowSorting="True" AutoGenerateColumns="False" DataKeyNames="InstituteID" 
            DataSourceID="sdsExpinstitutes" AutoGenerateDeleteButton="True" 
            AutoGenerateEditButton="True" CellPadding="4" ForeColor="#333333" 
            GridLines="None" onpageindexchanged="GridView1_PageIndexChanged" 
            onrowdatabound="GridView1_RowDataBound" 
            onselectedindexchanged="GridView1_SelectedIndexChanged">
           
             <EmptyDataTemplate>
                no record present
            </EmptyDataTemplate>
            <AlternatingRowStyle BackColor="White" />
            <Columns>
                <asp:CommandField ShowSelectButton="True" />
                <asp:BoundField DataField="InstituteID" HeaderText="InstituteID" 
                    InsertVisible="False" ReadOnly="True" Visible="false" SortExpression="InstituteID" />
                <asp:BoundField DataField="InstituteName" HeaderText="InstituteName" 
                    SortExpression="InstituteName" />
                <asp:BoundField DataField="YearOfEstablishment" 
                    HeaderText="YearOfEstablishment" SortExpression="YearOfEstablishment" />
                <asp:BoundField DataField="Area" HeaderText="Area" SortExpression="Area" />
               
                <asp:BoundField DataField="EmailID" HeaderText="EmailID" 
                    SortExpression="EmailID" />
                <asp:BoundField DataField="ContactNo" HeaderText="ContactNo" 
                    SortExpression="ContactNo" />
                <asp:BoundField DataField="WebSite" HeaderText="WebSite" 
                    SortExpression="WebSite" />

                    

                <asp:ButtonField CommandName="Edit" Text="Edit(fromButton)" DataTextField="InstituteID"
                    HeaderText="InstituteID" />
                <asp:CommandField EditText="Click To Edit" ShowEditButton="true" UpdateText="UpdateFields"
                    HeaderText="Update column" />
                <asp:TemplateField>
                    <ItemTemplate>
                        <%# Eval("InstituteName").ToString() %>
                    </ItemTemplate>
                    <EditItemTemplate>
                        <asp:TextBox ID="txtName" runat="server" Text='<%# Eval("InstituteName").ToString() %>'></asp:TextBox>
                    </EditItemTemplate>
                </asp:TemplateField>
              
                
            </Columns>
            <EditRowStyle BackColor="#2461BF" />
            
            <FooterStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
            <HeaderStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
            <PagerStyle BackColor="#2461BF" ForeColor="White" HorizontalAlign="Center" />
            <RowStyle BackColor="#EFF3FB" />
            <SelectedRowStyle BackColor="#D1DDF1" Font-Bold="True" ForeColor="#333333" />
            <SortedAscendingCellStyle BackColor="#F5F7FB" />
            <SortedAscendingHeaderStyle BackColor="#6D95E1" />
            <SortedDescendingCellStyle BackColor="#E9EBEF" />
            <SortedDescendingHeaderStyle BackColor="#4870BE" />
        </asp:GridView>
        <asp:SqlDataSource ID="sdsExpinstitutes" runat="server" 
            ConnectionString="<%$ ConnectionStrings:TCdbConnectionString %>" 
            SelectCommand="spInstituteGet" SelectCommandType="StoredProcedure" 
            DeleteCommand="DELETE FROM Institute WHERE (InstituteID = @instituteid)" 
            UpdateCommand="UPDATE Institute SET InstituteName = @InstituteName, YearOfEstablishment = @YearOfEstablishment, Area = @Area, EmailID = @EmailID, ContactNo = @ContactNo WHERE (InstituteID = @instituteid)">
            <DeleteParameters>
                <asp:Parameter Name="instituteid" />
            </DeleteParameters>
            <UpdateParameters>
                <asp:Parameter Name="InstituteName" />
                <asp:Parameter Name="YearOfEstablishment" />
                <asp:Parameter Name="Area" />
                <asp:Parameter Name="EmailID" />
                <asp:Parameter Name="ContactNo" />
                <asp:Parameter Name="instituteid" />
            </UpdateParameters>
        </asp:SqlDataSource>
    
    </div>
    </form>
</body>
</html>
